var http = require("http");
var url = require("url");
 
function start(route) {
  function onRequest(request, response) {
    var pathname = url.parse(request.url).pathname;
    route(pathname)
    response.writeHead(200, {"Content-Type": "text/plain;charset=utf-8"});
    response.write("打开服务器啦");
    response.end();
  }
 
  http.createServer(onRequest).listen(8080,()=>{
    console.log("已经启动：http://127.0.0.1:8080");
  });
}
exports.start = start;